import {
  Dialog,
  Toast
} from 'vant';

/**
 * 提示与加载工具类
 *
 * @export
 * @class Tips
 */
export default class Tips {
  /**
   * 文字提示
   *
   * @static
   * @param {any} title
   *
   * @memberOf Tips
   */
  static toast(title) {
    Toast(title);
  }

  /**
   * 成功文案
   *
   * @static
   * @param {any} title
   *
   * @memberOf Tips
   */
  static success(title) {
    Toast.success(title);
  }

  /**
   * 失败文案
   *
   * @static
   * @param {any} title
   *
   * @memberOf Tips
   */
  static fail(title) {
    Toast.fail(title);
  }

  /**
   * 加载提示
   *
   * @static
   * @param {string} [title='加载中...']
   *
   * @memberOf Tips
   */
  static loading(title = '加载中...') {
    Toast.loading({
      mask: true,
      message: title
    });
  }

  /**
   * 加载关闭
   *
   * @static
   *
   * @memberOf Tips
   */
  static loaded() {
    Toast.clear();
  }

  /**
   * 消息提示
   *
   * @static
   * @param {any} text
   * @param {string} [title='提示']
   * @returns
   *
   * @memberOf Tips
   */
  static alert(text, title = '提示') {
    return Dialog.alert({
      title: title,
      message: text
    });
  }

  /**
   * 消息确认
   *
   * @static
   * @param {any} text
   * @param {string} [title='提示']
   * @returns
   *
   * @memberOf Tips
   */
  static confirm(text, title = '提示') {
    return Dialog.confirm({
      title: title,
      message: text
    });
  }

  static action(title = '操作', items = []) {

  }


}
